from __future__ import annotations

from dataclasses import dataclass
from math import cos, sin, radians


@dataclass
class GroundBoomPerformance:
    boom_angle_deg: float
    lifting_capacity_kN: float
    base_reaction_kN: float
    note: str


def performance_point(load_kN: float, boom_length_m: float, angle_deg: float, counterweight_kN: float = 0.0) -> GroundBoomPerformance:
    """座地摇臂抱杆单点性能（力矩平衡近似）。"""

    theta = radians(angle_deg)
    moment_load = load_kN * boom_length_m * cos(theta)
    moment_cw = counterweight_kN * 0.6 * boom_length_m
    capacity = max(0.0, (moment_cw - 0.2 * moment_load))
    base_reaction = load_kN * sin(theta)
    return GroundBoomPerformance(boom_angle_deg=angle_deg, lifting_capacity_kN=capacity, base_reaction_kN=base_reaction, note="需建立几何与缆风绳约束模型")


